﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.AUTO.Adjust.Dto;
using NP.BPMReportPlatform.AUTO.Quotation.Dto;
using NP.BPMReportPlatform.AUTO.TechnicalDependence.Dto;
using NP.BPMReportPlatform.IC;
using NP.BPMReportPlatform.IC.ICZHYLS.Dto;
using NP.BPMReportPlatform.IUTS.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.ICSampler
{
    /// <summary>
    ///IC样品
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/icsamplerequest")]
    public class ICSamplerController : BPMReportPlatformController
    {
        private readonly IICSamplerAppService _iczhylsService;

        public ICSamplerController(IICSamplerAppService iczhylsService)
        {
            _iczhylsService = iczhylsService;
        }

        /// <summary>
        ///IC样品审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICSampler/GetAllAsync")]
        public async Task<PagedResultDto<ICSamplerOutput>> GetAllAsync([FromBody] GetICSamplerInput input)
        {
            return await _iczhylsService.GetAllAsync(input);
        }

        /// <summary>
        ///IC样品审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ICSampler/Export1Async")]
        public async Task<XlsxFileResult<ExportICSamplerOutput>> Export1Async([FromBody] GetICSamplerInput input)
        {
            var rst = await _iczhylsService.Export1Async(input);
            return new XlsxFileResult<ExportICSamplerOutput>(rst, "导出Excel");
        }

    }
}
